package leetcode.editor.cn;

public class ListNode {
    int val;
    ListNode next;

    ListNode(int x) {
        val = x;
        next = null;
    }

    ListNode(int x, ListNode p) {
        val = x;
        next = p;
    }
    public static void print(ListNode head){
        ListNode p=head;
        while(p!=null){
            System.out.print(p.val+" ");

            p=p.next;
        }
        System.out.println();
    }
}